<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>海报管理</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <script type="text/javascript">
        $(function () {
            initForm();
            saveEvent();
        });

        //初始化表单
        function initForm() {
            $("#formSet1").ligerForm({
                validate: true
            });
        }

        //保存事件
        function saveEvent() {
            $("#saveBtn1").click(function (event) {
                var form = liger.get("formSet1");
                if (!form.valid()) {
                    top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                    return false; //验证不通过，不执行以下代码
                }
                var data = form.getData();
                var url = '<%=path%>/carloan/odrphonenoteweb/modify.do';
                var wait_dialog;
                $.ligerDialog.confirm(LogUtils.LOG_CMM_SUBMIT_CONFIRM_CONTENT_001, function (flag) {
                    if (flag == false) return;
                    $.ajax({
                        type: 'post',
                        dataType: 'json',
                        data: data,
                        url: url,
                        beforeSend: function () {
                            wait_dialog = $.ligerDialog.SQalert({
                                content: LogUtils.LOG_CMM_DATA_LOADING,
                                SQ_type: "waitting"
                            });
                        },
                        success: function (msg) {
                            wait_dialog.close();
                            if (msg.success == 1) {
                                top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                                var callback = GET_W2Wcallback();
                                // callback();
                                Remove_navTab();
                            } else {
                                top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                            }
                        }
                    });
                });
            });
        }
    </script>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <form id="formSet1">
        <table class="layout2col1">
            <tbody>
            <tr>
                <td valign="top">
                    <div class="fieldset1 tabel_col clearFix">
                        <%-- <div class="fieldBox col_100_auto">
                            <div class="label">注册系统</div>
                            <div class="field">
                                <select name="sysCd" id="sysCd" validate="{required:true,select:true}">
                                    <option value=" " >请选择</option>
                                    <c:forEach items="${syscdlist }" var="syscdop">
                                        <option value="${syscdop.key }" <c:if test="${cmsbnrdc.sysCd == syscdop.key}">selected</c:if>>${syscdop.value }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div> --%>
                        <div class="fieldBox col_100_auto">
                            <div class="label">电销渠道&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <input name="compNm" id="compNm " type="text" class="ui-textbox"
                                       value="${comp.compNm}" disabled="disabled">
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto" hidden="hidden">
                            <div class="label">compId&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <input name="compId" id="compId " type="text" class="ui-textbox"
                                       value="${comp.id}">
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto" hidden="hidden">
                            <div class="label">phoneNoteWebId&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <input name="phoneNoteId" id="phoneNoteId " type="text" class="ui-textbox"
                                       value="${comp.odrPhoneNoteWebDTO.id}">
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto" hidden="hidden">
                            <div class="label">cstId&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <input name="cstId" id="cstId " type="text" class="ui-textbox"
                                       value="${comp.odrChannelInfoDTO.id}">
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto">
                            <div class="label">联系人姓名&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <input name="channelNm" id="channelNm" type="text" class="ui-textbox"
                                       value="${comp.odrChannelInfoDTO.channelNm}" disabled="disabled">
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto">
                            <div class="label">联系人电话<span style="color: red">*</span></div>
                            <div class="field">
                                <input name="channelMp" id="channelMp" type="text" class="ui-textbox"
                                       value="${comp.odrChannelInfoDTO.channelMp}" disabled="disabled">
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto">
                            <div class="label">联系人职位&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <select name="position" id="position">
                                    <option value=" ">--请选择--</option>
                                    <option value="0">企业法人</option>
                                    <option value="1">实际控制人</option>
                                    <option value="2">企业股东</option>
                                    <option value="3">负责人</option>
                                    <option value="4">业务经理</option>
                                    <option value="5">其他</option>
                                </select>
                                <%--<c:if test="${comp.odrPhoneNoteWebDTO.isConneced=='1'}">
                                    <input name="position" id="position " type="text" class="ui-textbox"

                                    <c:if test="${comp.odrChannelInfoDTO.position=='0'}">
                                           value="企业法人"
                                    </c:if>
                                    <c:if test="${comp.odrChannelInfoDTO.position=='1'}">
                                           value="实际控制人"
                                    </c:if>
                                    <c:if test="${comp.odrChannelInfoDTO.position=='2'}">
                                           value="企业股东"
                                    </c:if>
                                    <c:if test="${comp.odrChannelInfoDTO.position=='3'}">
                                           value="负责人"
                                    </c:if>
                                    <c:if test="${comp.odrChannelInfoDTO.position=='4'}">
                                           value="业务经理"
                                    </c:if>
                                    <c:if test="${comp.odrChannelInfoDTO.position=='5'}">
                                           value="其他"
                                    </c:if> disabled="disabled">
                                </c:if>--%>
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto">
                            <div class="label">接通状况<span style="color: red">*</span></div>
                            <div class="field">
                                <select name="isConnected" id="isConnected">
                                    <option value=" ">--请选择--</option>
                                    <option value="0">未接通</option>
                                    <option value="1">已接通</option>
                                </select>
                                <%--<c:if test="${comp.odrPhoneNoteWebDTO.isConneced=='1'}">
                                    <input name="isConnected" id="isConnected " type="text" class="ui-textbox"

                                    <c:if test="${comp.odrPhoneNoteWebDTO.isConneced=='0'}">
                                           value="未接通"
                                    </c:if>
                                    <c:if test="${comp.odrPhoneNoteWebDTO.isConneced=='1'}">
                                           value="已接通"
                                    </c:if> disabled="disabled">
                                </c:if>--%>
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto" hidden="hidden" id="isRealDiv">
                            <div class="label">是否真实有效&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <select name="isReal" id="isReal"
                                        <c:if test="${isAdmin=='1'}">disabled="disabled" </c:if>>
                                    <option value=" ">--请选择--</option>
                                    <option value="0">否</option>
                                    <option value="1">是</option>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto" hidden="hidden" id="notConnectedReasonDiv">
                            <div class="label">未接通原因&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <select name="notConnectedReason" id="notConnectedReason"
                                        <c:if test="${isAdmin=='1'}">disabled="disabled" </c:if>>
                                    <option value=" ">--请选择--</option>
                                    <option value="0">空号停机</option>
                                    <option value="1">无人接听</option>
                                    <option value="2">通话中/忙音</option>
                                    <option value="3">挂断</option>
                                </select>
                            </div>
                        </div>

                        <div class="fieldBox col_100_auto" hidden="hidden" id="isKpDiv">
                            <div class="label">是否kp&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <select name="isKp" id="isKp" <c:if test="${isAdmin=='1'}">disabled="disabled" </c:if>>
                                    <option value=" ">--请选择--</option>
                                    <option value="0">否</option>
                                    <option value="1">是</option>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto" id="intentionDiv">
                            <div class="label">客户意向&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <select name="intention" id="intention">
                                    <option value=" ">--请选择--</option>
                                    <option value="0">没有意向</option>
                                    <option value="1">可深入沟通</option>
                                    <option value="2">高意向有车可做</option>
                                    <option value="3">已和狮桥合作</option>
                                    <option value="4">公司不做车相关业务</option>
                                </select>
                            </div>
                        </div>


                        <%--<div class="fieldBox col_100_auto"  id="isOthermanDiv">
                            <div class="label">是否有其他联系人&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <select name="isOtherman" id="isOtherman" disabled="disabled">
                                    <option value="">--请选择--</option>
                                    <option value="0" disabled="disabled">否</option>
                                    <option value="1" disabled="disabled">是</option>
                                </select>
                            </div>
                        </div>--%>
                        <c:forEach items="${comp.otherChannels}" var="opt">
                        <div class="fieldBox col_100_auto" id="kpNmDiv">
                            <div class="label">新联系人姓名&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <input id="kpNm" type="text" class="ui-textbox"
                                       value="${opt.channelNm}" disabled="disabled">
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto" id="kpMpDiv">
                            <div class="label">新联系人电话<span style="color: red">*</span></div>
                            <div class="field">
                                <input id="kpMp" type="text" class="ui-textbox"
                                       value="${opt.channelMp}" disabled="disabled"><%--validate="{required:true}"--%>
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto" id="kpPositionDiv">
                            <div class="label">新联系人职位&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <input id="kpPosition" type="text" class="ui-textbox"
                                       value="${opt.position}" disabled="disabled"><%--validate="{required:true}"--%>
                            </div>
                        </div>
                        </c:forEach>
                        <div class="fieldBox col_100_auto">
                            <div class="label">三日内是否需要跟进&nbsp;<span style="color: red">*</span></div>
                            <div class="field">
                                <select name="isThreedayFollowIn" id="isThreedayFollowIn"
                                        <c:if test="${isAdmin=='1'}">disabled="disabled" </c:if>>
                                    <option value=" ">--请选择--</option>
                                    <option value="0">否</option>
                                    <option value="1">是</option>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_100_auto">
                            <div class="label">备注</div>
                            <div class="field">
                                         <textarea name="bz" id="bz" rows="6" class="ui-textarea l-textarea"
                                                   style="width:80%"
                                                   value=""
                                                   validate="{maxlength:500}"
                                                   <c:if test="${isAdmin=='1'}">disabled="disabled" </c:if>>${comp.odrPhoneNoteWebDTO.commments}</textarea>
                            </div>
                        </div>
                        <div id="btnsBox" class="btnsBox">
                            <c:if test="${isAdmin=='0'}">
                                <span id="saveBtn1" class="sq-button sq-button-round">修改</span>
                            </c:if>
                            <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
                        </div>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
<div class="clearLine"></div>
<script type="text/javascript">

    $("#isConnected").change(function () {
        $("#formSet1").ligerForm();
        var form = new liger.get("formSet1");
        var val = $("#isConnected").val();
        isConnectedChange(form);
    })


    $("#isOthermanDiv").change(function () {
        $("#formSet1").ligerForm();
        var form = new liger.get("formSet1");
        isOthermanChange(form);
    })

    function isConnectedChange(form) {
        var val = $("#isConnected").val();
        if (val == '0') {
            $("#notConnectedReasonDiv").show();//未接通原因展示
            $("#isRealDiv").hide();
            $("#isKpDiv").hide();
            $("#intentionDiv").hide();
            form.setData({
                isKp: " ",
                isReal: " ",
                intention: " ",
            });
        } else if (val == '1') {
            $("#notConnectedReasonDiv").hide();//未接通原因隐藏
            $("#isRealDiv").show();
            $("#isKpDiv").show();
            $("#intentionDiv").show();
            form.setData({
                notConnectedReason: " ",
            });
        } else {
            $("#notConnectedReasonDiv").hide();//未接通原因隐藏
            $("#isRealDiv").hide();
            $("#isKpDiv").hide();
            $("#intentionDiv").hide();
            form.setData({
                notConnectedReason: " ",
                isKp: " ",
                isReal: " ",
                intention: " ",
            });
        }
    }


    function isOthermanChange(form) {
        var val = $("#isOtherman").val();
        if (val == '0') {
            $("#kpNmDiv").hide();
            $("#kpMpDiv").hide();
            $("#kpPositionDiv").hide();
            form.setData({
                kpNm: " ",
                kpMp: " ",
                kpPosition: " ",
            });
        } else if (val == '1') {
            $("#kpNmDiv").show();
            $("#kpMpDiv").show();
            $("#kpPositionDiv").show();
        }
    }


    //数据回显
    $(function () {
        var form = new liger.get("formSet1");
        $("#intention").ligerComboBox().setValue('${comp.odrPhoneNoteWebDTO.intention}');
        $("#isThreedayFollowIn").ligerComboBox().setValue('${comp.odrPhoneNoteWebDTO.isThreedayFollowin}');
        $("#isConnected").ligerComboBox().setValue('${comp.odrPhoneNoteWebDTO.isConneced}');
        isConnectedChange(form);
        $("#position").ligerComboBox().setValue('${comp.odrChannelInfoDTO.position}');
        $("#notConnectedReason").ligerComboBox().setValue('${comp.odrPhoneNoteWebDTO.notConnecedReason}');
        $("#isKp").ligerComboBox().setValue('${comp.odrPhoneNoteWebDTO.isKp}');
        $("#isReal").ligerComboBox().setValue('${comp.odrPhoneNoteWebDTO.isReal}');
        isOthermanChange(form);
        <%--$("#kpPosition").ligerComboBox().setValue('${comp.odrPhoneNoteWebDTO.kpPosition}');--%>
    })
</script>
</body>

</html>